package io;

import java.io.BufferedWriter;
import java.io.FileOutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
import java.nio.charset.StandardCharsets;
import java.util.Scanner;

public class Test3 {
    public static void main(String[] args)throws Exception {
        FileOutputStream fos = new FileOutputStream("note.txt", true);
        OutputStreamWriter osw = new OutputStreamWriter(fos, StandardCharsets.UTF_8);
        BufferedWriter bw = new BufferedWriter(osw);
        PrintWriter pw = new PrintWriter(bw,true);

        Scanner scanner = new Scanner(System.in);
        while (true) {
            System.out.println("请输入内容：");
            String str = scanner.nextLine();
            if ("exit".equalsIgnoreCase(str)) {
                break;
            }
            pw.println(str);
        }
        pw.close();
    }
}
